|
|
|
|
|
|
|
Listing A.35. Coding the WrCreateField function. |
|
|
|
|
|
|
|
|
Public Function WrCreateField(fldObject As Field) As String
'
' create a field line
'
Dim cTemp As String
'
' get field from collection
cTemp = fldObject.Name
'
' if it has a space, enclose in braces
If InStr(cTemp, " ") <> 0 Then
cTemp = "[" + cTemp + "]"
End If
'
' add a spacer
cTemp = cTemp + " "
'
' add the field type
cTemp = cTemp + FieldTypeName(fldObject)
'
' if it's a text field, add the length
If fldObject.Type = dbText Then
cTemp = cTemp + "(" + CStr(fldObject.Size) + ")"
End If
'
' return results
WrCreateField = cTemp
'
End Function |
|
|
|
|
|
|
|
|
This routine calls the FieldTypeName function to convert the integer type value into a printable data type name. Add the FieldTypeName function from Listing A.36 to your project. |
|
|
|
|
|
|
|
|
Listing A.36. Coding the FieldTypeName function. |
|
|
|
|
|
|
|
|
Public Function FieldTypeName(fldObject As Field) As String
'
' get field type value
' return field string name
'
Select Case fldObject.Type
Case Is = dbDate
FieldTypeName = "DATE"
Case Is = dbText
FieldTypeName = "TEXT"
Case Is = dbMemo
FieldTypeName = "MEMO"
Case Is = dbBoolean
FieldTypeName = "BOOLEAN" |
|
|
|
|
|